package com.study.zouchao.superproject.util;

import android.content.Context;
import android.content.IntentFilter;
import android.support.design.widget.Snackbar;
import android.view.View;
import android.widget.ProgressBar;
import android.widget.Toast;

/**
 * Toast相关方法
 * Created by tsy on 16/8/15.
 */
public class ToastUtils {

    /**
     * 显示short message
     * @param context 全局context
     * @param resId string string资源id
     */
    public static void showShort(Context context, int resId) {
        if (context != null)
            Toast.makeText(context, resId, Toast.LENGTH_SHORT).show();
    }

    /**
     * 显示short message
     * @param context 全局context
     * @param message 显示msg
     */
    public static void showShort(Context context, String message) {
        if (context != null)
            Toast.makeText(context, message, Toast.LENGTH_SHORT).show();
    }

    /**
     * 显示long message
     * @param context 全局context
     * @param resId string string资源id
     */
    public static void showLong(Context context, int resId) {
        if (context != null)
            Toast.makeText(context, resId, Toast.LENGTH_LONG).show();
    }

    /**
     * 显示long message
     * @param context 全局context
     * @param message 显示msg
     */
    public static void showLong(Context context, String message) {
        if (context != null)
            Toast.makeText(context, message, Toast.LENGTH_LONG).show();
    }


    /**
     * SnackBar
     * @param title
     * @param showLength
     */
    public static void showSnackbar(View view, String title, int showLength) {
        if (view == null)   return;
        if (title == null)  return;
        Snackbar.make(view, StringUtils.strOmit((StringUtils.isEmpty(title)?"":title), 45), showLength)
                .show();
    }


}
